﻿using System;
using System.Xml;
using System.Xml.Serialization;

namespace MockingBird.Simulator.Framework.Configuration
{
    [Serializable]
    public class HandlerMapEntry
    {
        [XmlAttribute]
        public string Endpoint { get; set; }
        [XmlAttribute]
        public string HandlerName { get; set; }

        public override bool Equals(object obj)
        {
            if (obj == null) return false;

            if (this.GetType() != obj.GetType()) return false;

            // safe because of the GetType check
            HandlerMapEntry incomingEntry = (HandlerMapEntry)obj;

            // use this pattern to compare value members
            if (!HandlerName.Equals(incomingEntry.HandlerName)) return false;
            if (!Endpoint.Equals(incomingEntry.Endpoint)) return false;

            return true;
        }

    }
}
